package com.chinatsp.onlineapp.presenter;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import tsp.cn.http.BaseIDao;
import tsp.cn.http.HttpConfig;
import tsp.cn.http.interfac.INetResult;
import tsp.cn.http.tools.LogUtil;
import android.content.Context;

import com.chinatsp.onlineapp.base.Config;
import com.chinatsp.onlineapp.bean.AllCityBean;
import com.chinatsp.onlineapp.bean.HostParamsBean;
import com.google.gson.Gson;

public class GetAllCityDao extends BaseIDao {
	AllCityBean mAllCityBean;
	
	public GetAllCityDao(Context context, INetResult iNetResult) {
		super(context, iNetResult);
	}

	/**
	 * 得到结果，对结果进行处理
	 * 
	 * @param result
	 * @param requestCode
	 */
	@Override
	public void onRequestSuccess(String result, int requestCode) {
		LogUtil.d( "GetAllCityDao success ");
		mAllCityBean = new Gson().fromJson(result, AllCityBean.class);
	}

    public AllCityBean getAllCityBean(){
    	return mAllCityBean;
    }
    
	/**
	 * 热门城市
	 */
	public void getAllList() {
		LogUtil.d( "GetAllCityDao getAllList");
		StringBuilder strBuilder = new StringBuilder();
		strBuilder.append(HttpConfig.appendString());
		strBuilder.append(Config.API_QUERY_ALL_CITY_LIST);
		getRequest(strBuilder.toString(), Config.CODE_GET_ALL_CITY);
	}
}